package controllers;

import play.*;

import play.cache.Cache;
import play.mvc.*;
import play.mvc.Http.Cookie;

import java.util.*;

import models.*;

public class Application extends Controller {
	
	/*
	 * Test commit svn
	 */

    public static void index() 
    {
    	boolean is_auth = false;
    	Utilisateur user;
    	if(Security.isConnected())
    	{
    		is_auth = true;
    	}
    	
    	user = Utilisateur.find("byPseudo", Security.connected()).<Utilisateur>first();
    	
    	List<Sujet> courses = Course.find("select c from Course c where date_debut_course < NOW() and NOW() < date_fin_course order by date_debut_course desc").fetch(5);
    	
        render(is_auth, user, courses);
    }
    
    public static void authentify(String pseudo, String password)
    {
    	Security.authentify(pseudo, password);
    }

}